package Bill.app.serveur;


import java.io.*;
import java.net.Socket;
import java.util.Vector;

class GroupTraitement extends Thread
{

    GroupTraitement(Socket soc, Vector table, long connecte)
        throws IOException
    {
        lecture = null;
        ecriture = null;
        this.soc = null;
        this.table = null;
        this.connecte = 0L;
        login = null;
        this.soc = soc;
        this.table = table;
        this.connecte = connecte;
        ecriture = new PrintWriter(new BufferedWriter(new OutputStreamWriter(soc.getOutputStream())), true);
        String var = "";
        if(connecte == 1L)
            var = "premier";
        else
            var = (new StringBuilder(String.valueOf(connecte))).append("i\350me").toString();
        String mes = (new StringBuilder("info:vous etes le  ")).append(var).append(" client connect\351").toString();
        ecriture.println(mes);
        lecture = new BufferedReader(new InputStreamReader(soc.getInputStream()));
        login = lecture.readLine();
        start();
    }

    public void run()
    {
        table.add(ecriture);
        new GroupRecption(lecture, table, soc, login, connecte);
        Thread.yield();
    }

    BufferedReader lecture;
    PrintWriter ecriture;
    Socket soc;
    Vector table;
    long connecte;
    String login;
}
